<?php //debug($detallePaciente);                                                          ?>
<style>
    /*    popup*/
    #element_to_pop_up {
        background-color:#fff;
        box-shadow: 0px 2px 3px rgba(0, 0, 0, 0.298);
        border-radius:5px;
        color:#000;
        display:none;
        padding:2px;
        min-width:300px;
        min-height: 180px;
    }
    .b-close{
        cursor:pointer;
        position:absolute;
        right:10px;
        top:5px;
    }
    /*    popup*/

    .ac_results {
        padding: 0px;
        border: 1px solid black;
        background-color: white;
        overflow: hidden;
        z-index: 99999;
        color: black;
        /*        width: 600px;*/
    }

    .ac_results ul {
        width: 100%;
        list-style-position: outside;
        list-style: none;
        padding: 0;
        margin: 0;
    }

    .ac_results li {
        margin: 0px;
        padding: 2px 5px;
        cursor: default;
        display: block;
        /*
        if width will be 100% horizontal scrollbar will apear
        when scroll mode will be used
        */
        /*        width: 900px;*/
        font: menu;
        font-size: 12px;
        /*
        it is very important, if line-height not setted or setted
        in relative units scroll will be broken in firefox
        */
        line-height: 16px;
        overflow: hidden;
    }

    .ac_loading {
        background: white url('indicator.gif') right center no-repeat;
    }

    .ac_odd {
        background-color: #eee;
    }

    .ac_over {
        background-color: #0A246A;
        color: white;
    }
</style>
<?php
App::import('Model', 'Subclaseslaboratorio');
$subCL = new Subclaseslaboratorio();
?>
<?php $idPaciente=$detallePaciente['Paciente']['id']; ?>
<div class="page_title">
    <span class="title_icon"><span class="blocks_images"></span></span>
    <h3>Pacientes</h3>
</div>
<div id="content">
    <div class="grid_container">
        <span class="clear"></span>
        <div class="grid_6">
            <div class="widget_wrap">
                <div class="widget_top">
                    <span class="h_icon blocks_images"></span>
                    <h6>Datos del Paciente</h6>
                </div>
                <div class="widget_content">
                    <div class=" page_content">
                        <?php
                        $verificaColor = $alertaPaciente['Alerta']['color'];
                        //debug($color);
                        switch ($verificaColor)
                        {
                            case "rojo":
                                $color = "#D66";
                                $alerta = "ROJA";
                                break;
                            case "amarillo":
                                $color = "#FFFFAA";
                                $alerta = "AMARILLA";
                                break;
                            case "verde":
                                $color = "#008000";
                                $alerta = "VERDE";
                                break;
                            case "blanco":
                                $color = "#FFF";
                                $alerta = "BLANCA";
                                break;
                            default:
                                echo "No existe la alerta";
                        }
                        ?>

                        <span class="clear"></span>
                        <div class="stat_block" style="background: <?php echo $color; ?>">
                            <h4>ALERTA: <?php echo $alerta; ?></h4>
                            <h4>FECHA: <?php echo $ficha['Consultasexterna']['fecha'] ?> &nbsp;&nbsp;&nbsp; HORA <?php echo $ficha['Consultasexterna']['hora'] ?></h4>
                            <table>
                                <tbody>
                                    <tr>
                                        <td><b>NOMBRE</b></td>
                                        <td><?php echo $ficha['Paciente']['nombres'] ?></td>
                                    </tr>
                                    <tr>
                                        <td><b>APELLIDOS</b></td>
                                        <td><?php echo $ficha['Paciente']['ap_paterno'] . ' ' . $ficha['Paciente']['ap_materno'] ?></td>
                                    </tr>
                                    <tr>
                                        <td><b>SEGURO</b></td>
                                        <td><?php echo $seguro['Seguro']['nombre'] ?></td>
                                    </tr>
                                    <tr>
                                        <td><b>CURSO</b></td>
                                        <td><?php echo $seguro['SegurosPaciente']['curso'] ?></td>
                                    </tr>
                                    <?php if ($detallePaciente['Paciente']['lugar'] == 'provincia'): ?>
                                        <tr>
                                            <td><b>ALCALDIA / LOCALIDAD</b></td>
                                            <td><?php echo $detallePaciente['Paciente']['alcaldia'] ?>/<?php echo $detallePaciente['Paciente']['localidad'] ?></td>
                                        </tr>
                                        <tr>
                                            <td><b>CELULAR</b></td>
                                            <td><?php echo $detallePaciente['Paciente']['celular_p'] ?></td>
                                        </tr>
                                        <tr>
                                            <td><b>DEPARTAMENTO</b></td>
                                            <td><?php echo $detallePaciente['Departamentoprovincia']['nombre'] ?></td>
                                        </tr>
                                        <tr>
                                            <td><b>PRIVINCIA</b></td>
                                            <td><?php echo $detallePaciente['Provinciaprovincia']['nombre'] ?></td>
                                        </tr>
                                    <?php else: ?>
                                        <tr>
                                            <td><b>DIRECCION</b></td>
                                            <td><?php echo $detallePaciente['Paciente']['direccion'] ?></td>
                                        </tr>
                                        <tr>
                                            <td><b>TELEFONO</b></td>
                                            <td><?php echo $detallePaciente['Paciente']['telefono'] ?></td>
                                        </tr>
                                        <tr>
                                            <td><b>CELULAR</b></td>
                                            <td><?php echo $detallePaciente['Paciente']['celular'] ?></td>
                                        </tr>
                                        <tr>
                                            <td><b>DEPARTAMENTO</b></td>
                                            <td><?php echo $detallePaciente['Departamento']['nombre'] ?></td>
                                        </tr>
                                        <tr>
                                            <td><b>PROVINCIA</b></td>
                                            <td><?php echo $detallePaciente['Provincia']['nombre'] ?></td>
                                        </tr>
                                        <tr>
                                            <td><b>EMAIL</b></td>
                                            <td><?php echo $detallePaciente['Paciente']['correo'] ?></td>
                                        </tr>
                                    <?php endif; ?>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="grid_6">
            <div class="widget_wrap">
                <div class="widget_top">
                    <span class="h_icon blocks_images"></span>
                    <h6>Motivo de la Consulta Registrado (ENFERMERA)</h6>
                </div>
                <div class="widget_content">
                    <div class=" page_content">
                        <div class="invoice_container">
                            <h3><?php echo $ficha['Consultasexterna']['observaciones']; ?></h3>
                            <span class="clear"></span>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="grid_6">
            <div class="widget_wrap">
                <div class="widget_top">
                    <span class="h_icon blocks_images"></span>
                    <h6>Toma de signos vitales</h6>
                </div>
                <div class="widget_content">
                    <div class=" page_content">
                        <div class="invoice_container">
                            <div class="btn_30_orange" id="btMuestraDatosTomas">
                                <a>
                                    <span class="icon find_co"></span><span class="btn_link">MOSTRAR DATOS SIGNOS VITALES</span>
                                </a>
                            </div>
                            <?php //debug($medidasPaciente); ?>
                            <div id="muestraDatosTomas" style="display: none;">
                                <table class="wtbl_list">
                                    <thead>
                                        <tr>
                                            <th>No. </th>
                                            <th>Paremetro</th>
                                            <th>
                                                fecha - hora toma
                                            </th>
                                            <th>
                                                Valor
                                            </th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php $i = 1; ?>
                                        <?php foreach ($medidasPaciente as $mp): ?>

                                            <tr class="<?php echo $estilo = fmod($i, 2) ? "tr_even" : "tr_odd"; ?>">
                                                <td>
                                                    <?php echo $i; ?>
                                                </td>
                                                <td>
                                                    <?php echo $mp['Medida']['codigo']; ?>
                                                </td>
                                                <td>
                                                    <?php echo $this->Fechas->doFecha($mp['MedidasPaciente']['fecha']); ?>&nbsp;<?php echo $mp['MedidasPaciente']['hora']; ?>
                                                </td>
                                                <td>
                                                    <?php echo $mp['MedidasPaciente']['dato']; ?>
                                                </td>
                                            </tr>
                                            <?php $i++; ?>
                                        <?php endforeach; ?>
                                    </tbody>
                                </table>
                            </div>
                            <script>
                                $(document).ready(function() {
                                    $('#btMuestraDatosTomas').click(function() {
                                        $('#muestraDatosTomas').toggle('slow');
                                    });
                                });
                            </script>
                            <span class="clear"></span>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="grid_6">
            <div class="widget_wrap">
                <div class="widget_top">
                    <span class="h_icon blocks_images"></span>
                    <h6>Tomas de signos y sintomas aparentes</h6>
                </div>
                <div class="widget_content">
                    <div class=" page_content">
                        <div class="invoice_container">
                            <div class="btn_30_orange" id="btMuestraSintomas">
                                <a><span class="icon find_co"></span><span class="btn_link">MOSTRAR DATOS DE SINTOMAS</span></a>
                            </div>
                            <?php //debug($medidasPaciente); ?>
                            <div id="muestraSintomas" style="display: none; ">
                                <table class="wtbl_list">
                                    <thead>
                                        <tr>
                                            <th>No. </th>
                                            <th>
                                                Signo
                                            </th>
                                            <th>
                                                hora toma
                                            </th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php $i = 1; ?>
                                        <?php foreach ($conceptos as $c): ?>
                                            <?php
                                            $alerta = $c['Concepto']['alerta_id'];
                                            //debug($alerta);
                                            if ($alerta == 2)
                                                $color = "#FFC4C4";
                                            elseif ($alerta == 3)
                                                $color = "#ffffaa";
                                            elseif ($alerta == 4)
                                                $color = "#33FF66";
                                            else
                                                $color = "fff";
                                            ?>
                                            <tr style="background-color:  <?php echo $color ?>">
                                                <td>
                                                    <?php echo $i; ?>
                                                </td>
                                                <td>
                                                    <?php echo $c['Concepto']['signo']; ?>
                                                </td>
                                                <td>
                                                    <?php echo $mp['ConceptosPaciente']['hora']; ?>
                                                </td>

                                            </tr>
                                            <?php $i++; ?>
                                        <?php endforeach; ?>
                                    </tbody>
                                </table>
                            </div>
                            <script>
                                $(document).ready(function() {
                                    $('#btMuestraSintomas').click(function() {
                                        $('#muestraSintomas').toggle('slow');
                                    });
                                });
                            </script>
                            <span class="clear"></span>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <span class="clear"></span>

        <div class="grid_12">
            <div class="widget_wrap">
                <div class="widget_top">
                    <span class="h_icon list"></span>
                    <h6>Motivo de la Consulta</h6>
                </div>
                <span class="clear"></span>
                <br />
                <div class="widget_content">
                    <div class="btn_30_orange" id="btMuestraMotivosAnteriores">
                        <a>
                            <span class="icon find_co"></span><span class="btn_link">MOSTRAR MOTIVOS</span>
                        </a>
                    </div>
                    <div id="muestraMotivosRegistrados" style="display: none;">
                        <div id="cargaConsultas">
                            <table class="wtbl_list">
                                <thead>
                                    <tr>
                                        <th>Consultas</th>
                                        <th>Fecha Hora</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php $i = 0; ?>
                                    <?php foreach ($consultaDelPaciente as $cdp): ?>
                                        <tr class="<?php echo $estilo = fmod($i, 2) ? "tr_even" : "tr_odd"; ?>">
                                            <td><?php echo $cdp['Consultaspaciente']['observaciones']; ?></td>
                                            <td><?php echo $cdp['Consultaspaciente']['created']; ?></td>
                                        </tr>
                                        <?php $i++; ?>
                                    <?php endforeach; ?>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <script>
                        $(document).ready(function() {
                            $('#btMuestraMotivosAnteriores').click(function() {
                                $('#muestraMotivosRegistrados').toggle('slow');
                            });
                        });
                    </script>
                    <!--                        <form action="#" method="post" id="regitstraion_form" class="form_container left_label">-->
                    <?php //echo $this->Form->create('User', array('id' => 'regitstraion_form', 'class' => 'form_container left_label')); ?>
                    <div id="muestraExFisico" style="display: block">
                        <?php
                        echo $this->Ajax->form(array('type' => 'post',
                            'options' => array(
                                'model' => 'Consultaspaciente',
                                'class' => 'form_container',
                                'update' => 'cargaConsultas',
                                'url' => array(
                                    'controller' => 'Consultaspacientes',
                                    'action' => 'ajaxregistra'
                                ),
                            )
                        ));
                        ?>
                        <?php echo $this->Form->hidden('paciente_id', array('value' => $detallePaciente['Paciente']['id'])); ?>
                        <?php echo $this->Form->hidden('consultasexterna_id', array('value' => $idConsultaExterna)); ?>
                        <ul>
                            <li>
                                <div class="form_grid_12">
                                    <div class="form_input">
                                        <div class="form_grid_12">
                                            <label>Observaciones</label>
<!--                                            <input name="tin" type="text">											-->
                                            <!--<textarea name="data[Exfisicopaciente][observaciones]" class="input_grow" cols="50" rows="11" tabindex="5" style="width: auto; height: auto; overflow: hidden;"></textarea>-->
                                            <textarea name="data[Consultaspaciente][observaciones]" id="txt_editor2" cols="100" rows="5" tabindex="4" style="display: none; width: 492px; height: 152px;"></textarea>
                                            <?php //echo $this->Form->textarea('observaciones', array('rows'=>5, 'cols'=>100)); ?>
                                        </div>
                                        <span class="clear"></span>
                                    </div>
                                </div>
                            </li>

                            <li>
                                <div class="form_grid_12">
                                    <div class="form_input">
                                        <button type="submit" class="btn_small btn_blue"><span>Registrar</span></button>
                                        <button type="reset" class="btn_small btn_blue"><span>Limpiar datos</span></button>
                                    </div>
                                </div>
                            </li>
                        </ul>
                        </form>
                    </div>
                    <script>
                        $(document).ready(function() {
                            $('#btNuevoExFisico').click(function() {
                                $('#muestraExFisico').toggle('slow');
                            });
                            $("#txt_editor2").cleditor({
                                width: "100%",
                                height: "100%",
                                bodyStyle: "margin: 10px; font: 12px Arial,Verdana; cursor:text"
                            });
                        });
                    </script>
                </div>
            </div>
        </div>

        <span class="clear"></span>

        <div class="grid_12">
            <div class="widget_wrap">
                <div class="widget_top">
                    <span class="h_icon list"></span>
                    <h6>Examen Fisico</h6>
                </div>
                <span class="clear"></span>
                <br />
                <div class="widget_content">
                    <div class="btn_30_orange" id="btMuestraExamenesRegistrados">
                        <a>
                            <span class="icon find_co"></span><span class="btn_link">MOSTRAR EXAMENES</span>
                        </a>
                    </div>
                    <div id="muestraExamenesRegistrados" style="display: none;">
                        <div id="cargaExaFisicos">

                            <table class="wtbl_list">
                                <thead>
                                    <tr>
                                        <th>Examenes</th>
                                        <th>Fecha Hora</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php $i = 0; ?>
                                    <?php foreach ($examenDelPaciente as $edp): ?>
                                        <tr class="<?php echo $estilo = fmod($i, 2) ? "tr_even" : "tr_odd"; ?>">
                                            <td><?php echo $edp['Exfisicopaciente']['observaciones']; ?></td>
                                            <td><?php echo $edp['Exfisicopaciente']['created']; ?></td>
                                        </tr>
                                        <?php $i++; ?>
                                    <?php endforeach; ?>
                                </tbody>
                            </table>

                        </div>
                    </div>
                    <script>
                        $(document).ready(function() {
                            $('#btMuestraExamenesRegistrados').click(function() {
                                $('#muestraExamenesRegistrados').toggle('slow');
                            });
                        });
                    </script>
                    <span class="clear"></span>
                    <br />
                    <!--                        <form action="#" method="post" id="regitstraion_form" class="form_container left_label">-->
                    <?php //echo $this->Form->create('User', array('id' => 'regitstraion_form', 'class' => 'form_container left_label')); ?>
                    <div id="muestraExFisico" style="display: block">
                        <?php
                        echo $this->Ajax->form(array('type' => 'post',
                            'options' => array(
                                'model' => 'Exfisicopaciente',
                                'class' => 'form_container',
                                'update' => 'cargaExaFisicos',
                                'url' => array(
                                    'controller' => 'Exfisicopacientes',
                                    'action' => 'ajaxregistra'
                                ),
                            )
                        ));
                        ?>
                        <?php echo $this->Form->hidden('paciente_id', array('value' => $detallePaciente['Paciente']['id'])); ?>
                        <?php echo $this->Form->hidden('consultasexterna_id', array('value' => $idConsultaExterna)); ?>
                        <ul>
                            <li>
                                <div class="form_grid_12">
                                    <div class="form_input">
                                        <div class="form_grid_12">
                                            <label>Observaciones</label>
<!--                                            <input name="tin" type="text">											-->
                                            <!--<textarea name="data[Exfisicopaciente][observaciones]" class="input_grow" cols="50" rows="11" tabindex="5" style="width: auto; height: auto; overflow: hidden;"></textarea>-->
                                            <textarea name="data[Exfisicopaciente][observaciones]" id="txt_editor" cols="100" rows="5" tabindex="4" style="display: none; width: 492px; height: 152px;"></textarea>
                                            <?php //echo $this->Form->textarea('observaciones', array('rows'=>5, 'cols'=>100)); ?>
                                        </div>
                                        <span class="clear"></span>
                                    </div>
                                </div>
                            </li>

                            <li>
                                <div class="form_grid_12">
                                    <div class="form_input">
                                        <button type="submit" class="btn_small btn_blue"><span>Registrar</span></button>
                                        <button type="reset" class="btn_small btn_blue"><span>Limpiar datos</span></button>
                                    </div>
                                </div>
                            </li>
                        </ul>
                        </form>
                    </div>
                    <script>
                        $(document).ready(function() {
                            $('#btNuevoExFisico').click(function() {
                                $('#muestraExFisico').toggle('slow');
                            });
                        });
                    </script>
                </div>
            </div>
        </div>

        <span class="clear"></span>

        <div class="grid_6">
            <div class="widget_wrap">

<!--                <div id="element_to_pop_up">
                    <a class="b-close">X</a>
                    <h6>REGISTRO DE LABORATORIOS </h6><div class="clear"></div>
                    &nbsp;
                    <?php // echo $this->Form->create('Movimientostubos', array('action' => 'ingresoalmacen', 'id' => "validate")); ?>
                    <div class="item_widget">
                        <div class="widget_wrap tabby">
                            <div class="widget_top">
                                <span class="h_icon bended_arrow_right"></span>
                                <h6>LABORATORIOS</h6>
                                <div id="widget_tab">
                                    <ul>
                                        <?php // foreach ($clasesDeLaboratorios as $cdl): ?>
                                            <li><a href="#tab_<?php echo $cdl['Claseslaboratorio']['id'] ?>" class="active_tab"><?php echo $cdl['Claseslaboratorio']['nombre'] ?></a></li>
                                        <?php // endforeach; ?>
                                    </ul>
                                </div>
                            </div>
                            <div class="widget_content">
                                <?php // foreach ($clasesDeLaboratorios as $cdl): ?>
                                    <div id="tab_<?php // echo $cdl['Claseslaboratorio']['id'] ?>">
                                        <?php
//                                        $laboratorios = $subCL->find('all', array(
//                                            'recursive' => -1,
//                                            'conditions' => array('claseslaboratorio_id' => $cdl['Claseslaboratorio']['id'])
//                                        ));
                                        //debug($laboratorios);
                                        ?>
                                        <div class="item_widget">
                                            <?php // foreach ($laboratorios as $lab): ?>
                                                <input name="field08" class="checkbox" type="checkbox" value="First" tabindex="7">
                                                <label class="choice"><?php echo $lab['Subclaseslaboratorio']['nombre'] ?></label>
                                            <?php //endforeach; ?>
                                        </div>
                                    </div>
                                <?php //endforeach; ?>
                            </div>
                        </div>
                    </div>
                </div>-->

                <div class="widget_top">
                    <span class="h_icon blocks_images"></span>
                    <h6>Laboratorios</h6>
                </div>
                <div class="widget_content">
                    <div class="btn_30_orange" id="btMuestraExamenesRegistrados">
                        <a>
                            <span class="icon find_co"></span><span class="btn_link">MOSTRAR LABORATORIOS</span>
                        </a>
                    </div>
                    <div class=" page_content">
                        <div class="invoice_container">
<!--                            <a id="btAjaxLaboratorios">Demo Lab<?php // echo $this->Html->image("iconos/inBox.png", array('title' => 'ingreso laboratorios')) ?></a>-->
<!--                            <script>
                                $(document).ready(function() {
                                    // Binding a click event
                                    // From jQuery v.1.7.0 use .on() instead of .bind()
                                    $('#btAjaxLaboratorios').bind('click', function(e) {

                                        // Triggering bPopup when click event is fired
                                        $('#element_to_pop_up').bPopup({
                                            fadeSpeed: 'slow', //can be a string ('slow'/'fast') or int
                                            followSpeed: 1500, //can be a string ('slow'/'fast') or int
                                            width: 20,
                                            position: [10, 'auto']
                                                    //$('#element_to_pop_up_<?php //echo $t['Tubo']['id'];                    ?>').bPopup()
                                        });
                                    });
                                });
                            </script>-->
                            <div id="cargaLaboratorios" style="display: none">
                                <table class="wtbl_list">
                                    <thead>
                                        <tr>
                                            <th>Laboratorio</th>
                                            <!-- <th>Examen</th>  -->
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php $i = 1; ?>
                                        <?php foreach ($laboratoriosDelPaciente as $lp): ?>
                                            <tr class="<?php echo $estilo = fmod($i, 2) ? "tr_even" : "tr_odd"; ?>">
                                                <td>
                                                    <?php echo $lp['Subclaseslaboratorio']['nombre']; ?>
                                                </td>
                                                <td>
                                                    <?php echo $lp['Laboratorio']['nombre']; ?>
                                                </td>
                                            </tr>
                                            <?php $i++; ?>
                                        <?php endforeach; ?>
                                    </tbody>
                                </table>
                            </div>
                            <span class="clear"></span>
                            <div class="btn_30_blue">
                                <a href="<?php echo $this->Html->url(array('controller' => 'Laboratoriospacientes', 'action' => 'registralaboratorio', $detallePaciente['Paciente']['id'], $idConsultaExterna)); ?>">
                                    <span class="icon application2_co"></span>
                                    <span class="btn_link">REGISTRA LABORATORIO</span>
                            </a>
                            </div>
                            

                           

                            <div id="muestraNuevoLaboratorio" style="display: none;">
                                <?php //echo $this->Form->create('Paciente', array('id' => "form103", 'class' => "form_container left_label valid_tip", 'action' => 'registralab')) ?>
                                <?php
                                echo $this->Ajax->form(array('type' => 'post',
                                    'options' => array(
                                        'model' => 'Pacientes',
                                        'update' => 'cargaLaboratorios',
                                        'url' => array(
                                            'controller' => 'Pacientes',
                                            'action' => 'ajaxregistralab'
                                        ),
                                    )
                                ));
                                ?>
                                <ul>
                                    <li>
                                        <div class="form_grid_12">
                                            <?php
                                            $idPacienteLab = $detallePaciente['Paciente']['id'];
                                            ?>
                                            <?php echo $this->Form->hidden('paciente_id', array('value' => $idPacienteLab)); ?>
                                            <?php echo $this->Form->hidden('consultasexterna_id', array('value' => $idConsultaExterna)); ?>
                                            <select data-placeholder="Seleccione la Categoria..." class="chzn-select full" name="data[Pacientes][categoria_id]" tabindex="4" id="clasesLab" style="width: 300px;">
                                                <option value="0" selected="selected">Seleccione una Categoria</option>
                                                <?php foreach ($clasesDeLaboratorios as $cdl): ?>
                                                    <option value="<?php echo $cdl['Claseslaboratorio']['id'] ?>">
                                                        <?php echo $cdl['Claseslaboratorio']['nombre'] ?>

                                                    </option>
                                                <?php endforeach; ?>
                                            </select>
                                        </div>
                                        <p>&nbsp;</p>
                                    </li>
                                    <li>
                                        <div id="cargaSubLaboratorios">
                                            <h1>&nbsp;</h1>
                                            <h1>&nbsp;</h1>
                                            <h1>&nbsp;</h1>
                                            <h1>&nbsp;</h1>
                                            <h1>&nbsp;</h1>
                                            <h1>&nbsp;</h1>
                                            <h1>&nbsp;</h1>
                                            <h1>&nbsp;</h1>
                                        </div>
                                    </li>
                                </ul>

                                </form>
                                <script>
                                    $(document).ready(function() {
                                        //clases will be change
                                        $('#clasesLab').change(function() {
                                            //$(selector).load(URL,data,callback);
                                            $('#cargaSubLaboratorios').load("<?php echo $this->Html->url(array('controller' => 'Laboratorios', 'action' => 'ajaxsublaboratorios')); ?>/" + this.value);
                                            console.log(this.value);
                                        });

                                        $('#btNuevoLaboratorio').click(function() {
                                            $('#muestraNuevoLaboratorio').toggle('slow');
                                        });
                                    });
                                </script>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
<!--muestra la parte de registro de cie10-->
        <div class="grid_6">
            <div class="widget_wrap">
                <div class="widget_top">
                    <span class="h_icon list"></span>
                    <h6>Registro Cie10</h6>
                </div>
                <span class="clear"></span>
                <br />
                <div class="widget_content">
                    <div id="cargaciedes">
                        <table class="wtbl_list">
                            <thead>
                                <tr>
                                    <th>Codigo</th>
                                    <th>Descripcion</th>
                                    <th>Obs.</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php $i = 1; ?>
                                <?php foreach ($cie10Paciente as $cdp): ?>
                                    <tr class="<?php echo $estilo = fmod($i, 2) ? "tr_even" : "tr_odd"; ?>">
                                        <td><?php echo $cdp['Ciede']['cod4']; ?></td>
                                        <td><?php echo $cdp['Ciede']['descod4']; ?></td>
                                        <td><?php echo $cdp['CiedesPaciente']['observaciones']; ?></td>
                                    </tr>
                                    <?php $i++; ?>
                                <?php endforeach; ?>
                            </tbody>
                        </table>
                    </div>
                    <span class="clear"></span>
                    <br />
                    <button type="reset" class="btn_small btn_blue" id="btNuevoCie10">
                        <span>Registrar Nuevo Cie10</span>
                    </button>
                    <!--                        <form action="#" method="post" id="regitstraion_form" class="form_container left_label">-->
                    <?php //echo $this->Form->create('User', array('id' => 'regitstraion_form', 'class' => 'form_container left_label')); ?>
                    <div id="muestraCie10" style="display: none">
                        <?php
                        echo $this->Ajax->form(array('type' => 'post',
                            'options' => array(
                                'model' => 'CiedesPaciente',
                                'class' => 'form_container left_label',
                                'update' => 'cargaciedes',
                                'url' => array(
                                    'controller' => 'CiedesPacientes',
                                    'action' => 'ajaxregistra'
                                ),
                            )
                        ));
                        ?>
                        <ul>
                            <li>
                                <div class="form_grid">
                                    <label class="field_title" for="name">Busqueda cie10</label>
                                    <div class="form_input_12">
                                        <?php echo $this->Form->hidden('paciente_id', array('value' => $detallePaciente['Paciente']['id'])); ?>
                                        <?php echo $this->Form->hidden('consultasexterna_id', array('value' => $idConsultaExterna)); ?>
                                        <?php echo $this->Ajax->autoComplete('Ciede.descod4', '/Ciedes/ajaxautocomplete', array('extraParams' => 1)); ?>
                                    </div>
                                </div>
                            </li>

                            <li>
                                <div class="form_grid">
                                    <label class="field_title" for="name">Observaciones </label>
                                    <div class="form_input_12">
                                       <?php echo $this->Form->textarea('observaciones'); ?>
                                    </div>
                                </div>
                            </li>

                            <li>
                                <div class="form_grid_12">
                                    <div class="form_input">
                                        <button type="submit" class="btn_small btn_blue"><span>Registrar CIE10</span></button>
                                        <button type="reset" class="btn_small btn_blue"><span>Limpiar datos</span></button>
                                    </div>
                                </div>
                            </li>
                        </ul>
                        </form>
                    </div>
                    <script>
                        $(document).ready(function() {
                            $('#btNuevoCie10').click(function() {
                                $('#muestraCie10').toggle('slow');
                            });
                        });
                    </script>
                </div>
            </div>
        </div>
        <span class="clear"></span>


<!--muestra las recetas y registra nuevas-->

        <div class="grid_12">
            <div class="widget_wrap">
                <div class="widget_top">
                    <span class="h_icon list"></span>
                    <h6>Registro Receta</h6>
                </div>
                <span class="clear"></span>
                <br />
                <div class="widget_content">
                    <div class="btn_30_orange" id="btMuestraRecetas">
                        <a>
                            <span class="icon find_co"></span><span class="btn_link">MOSTRAR RECETAS</span>
                        </a>
                    </div>


                    <div class="btn_30_orange">                        
                        <a href="<?php echo $this->Html->url(array('controller'=>'Recetaspacientes', 'action'=>'registra', $idPaciente, $idConsultaExterna)); ?>">
                            <span class="icon find_co"></span><span class="btn_link">REGISTRAR RECETAS</span>
                        </a>
                    </div>


                    <div id="muestraRecetas" style="display: none;">
                        <div id="cargaRecetas">
                            <table class="wtbl_list">
                                <thead>
                                    <tr>
                                        <th>Medicamento</th>
                                        <th>Cantidad</th>
                                        <th>Precio</th>
                                        <th>Fecha Hora</th>
                                        <th>Dosis</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php $i = 0; ?>
                                    <?php foreach ($recetasDelPaciente as $rdp): ?>
                                        <tr class="<?php echo $estilo = fmod($i, 2) ? "tr_even" : "tr_odd"; ?>">
                                            <td><?php echo $rdp['Recetaspaciente']['medicamento']; ?></td>
                                            <td><?php echo $rdp['Recetaspaciente']['cantidad']; ?></td>
                                            <td><?php echo $rdp['Recetaspaciente']['precio']; ?></td>
                                            <td><?php echo $rdp['Recetaspaciente']['created']; ?></td>
                                            <td><?php echo $rdp['Recetaspaciente']['observaciones']; ?></td>
                                        </tr>
                                        <?php $i++; ?>
                                    <?php endforeach; ?>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <script>
                        $(document).ready(function() {
                            $('#btMuestraRecetas').click(function() {
                                $('#muestraRecetas').toggle('slow');
                            });
                        });
                    </script>

                    <div id="muestraOtraReceta" style="display: block">
                        <?php
                        echo $this->Ajax->form(array('type' => 'post',
                            'options' => array(
                                'model' => 'Recetaspaciente',
                                'class' => 'form_container',
                                'update' => 'cargaRecetas',
                                'url' => array(
                                    'controller' => 'Recetaspacientes',
                                    'action' => 'ajaxregistra'
                                ),
                            )
                        ));
                        ?>
                        <?php echo $this->Form->hidden('paciente_id', array('value' => $detallePaciente['Paciente']['id'])); ?>
                        <?php echo $this->Form->hidden('consultasexterna_id', array('value' => $idConsultaExterna)); ?>
                        
                       
                        </form>
                    </div>
                    <script>
                        $(document).ready(function() {
                            $('#btMuestraRecetas').click(function() {
                                $('#muestraReceta').toggle('slow');
                            });
                        $("#txt_editor3").cleditor({
                                width: "100%",
                                height: "100%",
                                bodyStyle: "margin: 10px; font: 12px Arial,Verdana; cursor:text"
                            });
                        });
                    </script>
                </div>
            </div>
                    <script>
                        $(document).ready(function() {
                            $('#btMuestraRecetas').click(function() {
                                $('#muestraOtraReceta').toggle('slow');
                            });
                            $("#txt_editor2").cleditor({
                                width: "100%",
                                height: "100%",
                                bodyStyle: "margin: 10px; font: 12px Arial,Verdana; cursor:text"
                            });
                        });
                    </script>
                </div>
            </div>
        </div>
